<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="https://cdn.jsdelivr.net/npm/vue"></script>
    <style>

    </style>
</head>

<body>
    <div id="app">
        <input type="text" v-model="val1">
        <p>{{val1}}</p>
        <hr>
        <!-- 手动实现v-model  -->
        <input type="text" :value="val2" @input="myInput">
        <p>{{val2}}</p>
    </div>
</body>
<script>
    var vm = new Vue({
        el: '#app',
        data: {
            val1: '初始值1',
            val2: '初始值2'
        },
        methods: {
            myInput(e) {
                this.val2 = e.target.value
            }
        },
    })
</script>

</html>